/*
 * author      : 吴中勤 
 * date        : 2018/9/15
 * description : TODO
 */

package com.deepexi.adapter.converter.sap;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormatConvert {

    public static final String getTimestamp(String dateStr) {
        try {
            Date temp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr);
            return new SimpleDateFormat("yyyyMMddHHmmss").format(temp);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }


    public static final String getDate(String dateStr) {
        try {
            Date temp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr);
            return new SimpleDateFormat("yyyyMMdd").format(temp);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
